package com.wl4837;

// 具体元素 - 计算机(包含多个部件)
class Computer implements ComputerPart {

    private final ComputerPart[] parts;

    public Computer() {
        this.parts = new ComputerPart[]{
                new Mouse(), new Keyboard(), new Monitor()
        };
    }

    @Override
    public void accept(ComputerPartVisitor visitor) {
        for (ComputerPart part : parts) {
            part.accept(visitor);
        }
        visitor.visit(this);
    }

}
